﻿using System.Web.Mvc;

namespace GuRenFang.Web.Areas.Management
{
    public class ManagementAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "Management";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            context.Routes.IgnoreRoute("elmah.axd");
            context.Routes.IgnoreRoute("{*alljs}", new { alljs = @".*\.js?" });
            context.Routes.IgnoreRoute("{*allashx}", new { allashx = @".*\.ashx?" });
            context.Routes.IgnoreRoute("{*allhtml}", new { allhtml = @".*\.htm?" });
            context.Routes.IgnoreRoute("{*allcss}", new { allcss = @".*\.css?" });
            context.Routes.IgnoreRoute("{*allimages}", new { allimages = @".*\.ico?|.*\.jpg?|.*\.png?|.*\.gif?" });

            context.MapRoute(
                 "Login",
                "Management/Login",
                 new { controller = "Default", action = "Login", id = UrlParameter.Optional}, new string[] { "GuRenFang.Controllers.Management" } 
            );
            context.MapRoute(
                 "LogOff",
                "Management/Logoff",
                 new
                 {
                     controller = "Default",
                     action = "LogOff",
                     id = UrlParameter.Optional
                 } , new string[] { "GuRenFang.Controllers.Management" } 
            );
            context.MapRoute(
                 "about us",
                "Management/AboutUs",
                 new
                 {
                     controller = "Default",
                     action = "AboutUs",
                     id = UrlParameter.Optional
                 }, new string[] { "GuRenFang.Controllers.Management" }
            );
            context.MapRoute(
                 "Tips",
                "Management/Tips",
                 new
                 {
                     controller = "Default",
                     action = "Tips",
                     id = UrlParameter.Optional
                 }, new string[] { "GuRenFang.Controllers.Management" }
            );
            
            context.MapRoute(
                "Management_default",
                "Management/{controller}/{action}/{id}",
                new { controller = "Default", action = "Default", id = UrlParameter.Optional }, new string[] { "GuRenFang.Controllers.Management" }
            );
        }
    }
}
